﻿// Brandon Haynes - http://brandonhaynes.org
// Copyright (c) 2008
// by Brandon Haynes

// Please refer to the project license, located at http://www.codeplex.com/DNNLocalization/license

// The above copyright notice and this permission notice shall be included in all copies or substantial portions 
// of the Software.

//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
//INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
//DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
//SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
//SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
//WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 
//USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

using System;
using System.Resources;

namespace BrandonHaynes.DotNetNukeResXBuildProvider
	{
	public class DecoratedHybridResourceManager : ResourceManager
		{
		public string VirtualPath { get; set; }

		public DecoratedHybridResourceManager(Type type, string virtualPath)
			: base(type)
			{ VirtualPath = virtualPath; }

		public override string GetString(string name)
			{
			return DotNetNuke.Services.Localization.Localization.GetString(name, VirtualPath);
			}

		public override string GetString(string name, System.Globalization.CultureInfo culture)
			{
			if(culture == null)
				return DotNetNuke.Services.Localization.Localization.GetString(name, VirtualPath);
			else
				return DotNetNuke.Services.Localization.Localization.GetString(name, VirtualPath, culture.Name);
			}
		}
	}
